<!DOCTYPE html>
<html lang="zh-CN">

    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="/static/css/common.css">
        <link rel="stylesheet" href="/static/css/category.css">
        <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
        <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
        <title>文章分类</title>
    </head>

    <body>
        <!-- 移动端菜单栏 -->
        <div class="mobile-menu">
            <span class="mobile-menu-icon">
                <i class="layui-icon layui-icon-menu-fill"></i>
            </span>
            <div class="mobile-menu-content">
                <p>
                    <a href="/">首页</a>
                </p>
                <p>
                    <a href="/">归档</a>
                </p>
                <p>
                    <a href="/">关于</a>
                </p>
                <p>
                    <a target="_blank" href="https://www.ghxi.com/">资源</a>
                </p>
            </div>
        </div>


        <div class="container">
            <!-- 左侧菜单栏 -->
            <div class="side-bar">
                <!-- logo -->
                <div class="logo-wrapper">
                    <img src="/static/img/logo.png" alt="听雨" onclick="window.location.href='/';" />
                    <h1>听雨</h1>
                </div>
                <!-- 联系方式 -->
                <div class="contact-wrapper">
                    <span class="contact-email">
                        <img src="/static/img/email.svg" alt="1186472484@qq.com" />
                    </span>
                    <span class="contact-gitee">
                        <img src="/static/img/gitee.svg" alt="https://gitee.com/yuguofu/" href="https://gitee.com/yuguofu/"
                            onclick="window.open(this.getAttribute('href'));" />
                    </span>
                </div>
                <!-- 导航链接 -->
                <div class="navlink">
                    <ul class="navlist">
                        <li>
                            <a href="/">首页</a>
                        </li>
                        <li>
                            <a href="/archive">归档</a>
                        </li>
                        <li>
                            <a href="/about">关于</a>
                        </li>
                        <li>
                            <a target="_blank" href="https://www.ghxi.com/">资源</a>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- 分类 -->
            <div class="cate-wrapper">
                <blockquote class="layui-elem-quote">
                    <h2>分类<span class="cate-name">{{.cate_name}}</span>的文章</h2>
                </blockquote>

                <div class="cate-tags">

                    @zig {
                        if (zmpl.get("categories")) |cates| { 
                            for (cates.items(.array)) |cate| {
                                // const id = cate.get("id");
                                const name = cate.get("name");
                                const count = cate.get("count");

                                
                                <a class="item" href="/cate/{{name}}/articles">
                                    {{name}} <div class="label green">{{count}}</div>
                                </a>
                                
                            }

                        }
                    }

                </div>

                <div class="cate-main">
                    @zig {
                        if (zmpl.get("articles")) |arts| { 
                            for (arts.items(.array)) |art| {
                                const id = art.get("id");
                                const title = art.get("title");
                                const description = art.get("description");
                                // const istop = art.get("istop");
                                const cate_name = art.get("cate_name");
                                const created_at = art.get("created_at");

                                <div class="article-card">
                                    <h2 class="article-title">
                                        <a href="/article/{{id}}">{{title}}</a>
                                    </h2>
                                    <div class="article-des">
                                        <p>
                                            {{description}}
                                        </p>
                                    </div>
                                    <div class="article-info">
                                        <span>作者：听雨</span>
                                        <span class="info-cate">分类：{{cate_name}}</span>
                                        <span class="info-created">发布时间：{{created_at}}</span>
                                    </div>
                                </div>
                                
                                
                            }

                        }
                    }

                </div>
            </div>

        </div>


    </body>

</html>